home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 21.zip / BS1 part 21 / Professional Page v4.0 (1993)(Gold Disk)(Disk 1 of 4)[HD].7z / Professional Page v4.0 (1993)(Gold Disk)(Disk 1 of 4)[HD].adf / rexx.lzh / CopyBoxToPages.pprx < prev    next >
Text File  |  1992-03-13  |  2KB  |  87 lines

  1. /*
  2. @BCopyBoxToPages  @P@ICopyright Gold Disk Inc. February, 1992
  3.  
  4. This Genie will copy a box and its contents to a range of pages.
  5. */
  6. address command
  7. call SafeEndEdit.rexx()
  8. call ppm_AutoUpdate(0)
  9. arg box, startpage, endpage
  10. pageoptions = "ODDEVENALL "
  11.  
  12. if box = '' then
  13. do
  14.     box =  ppm_ClickOnBox("Click on the box to be copied..")
  15.     if box = 0 then exit_msg()
  16.     docstart = ppm_DocFirstPage()
  17.     docend = ppm_DocLastPage()
  18.  
  19.     form = "Start Page:"docstart'0a'x "End Page:"docend'0a'x "ODD/EVEN/ALL"
  20.     form = upper(ppm_GetForm("Enter options", 8, form))
  21.     if form = '' then exit_msg()
  22.  
  23.     parse var form startpage '0a'x endpage '0a'x pageopts
  24.  
  25.     if endpage = '' then exit_msg('Invalid Range')
  26.     if pageopts = '' then pageopts = 'ALL'
  27.  
  28.     if startpage < docstart then exit_msg('Invalid Range')
  29.     else if startpage > docend then exit_msg('Invalid Range')
  30.     if endpage < docstart then exit_msg('Invalid Range')
  31.     else if endpage > docend then exit_msg('Invalid Range')
  32.     if endpage < startpage then exit_msg('Invalid Range')
  33. end
  34.  
  35. if upper(word(ppm_GetBoxInfo(box), 1)) = "TEXT" & ppm_TextOverFlow(box) then
  36.     text = ppm_GetArticleText(box,1)
  37. else
  38.     text = ''
  39.  
  40. if datatype(startpage) ~= 'NUM' | datatype(endpage) ~= 'NUM' then
  41.     call exit_msg("Invalid input")
  42.  
  43. if verify(pageopts, pageoptions) ~= 0 then exit_msg("Invalid Input")
  44.  
  45. opos = pos(pageopts, pageoptions) 
  46.  
  47. if opos = 4 then
  48. do
  49.     increment = 2
  50.     if (startpage // 2) then startpage = startpage + 1
  51. end
  52. else if opos = 1 then
  53. do
  54.     increment = 2
  55.     if ~(startpage // 2) then startpage = startpage + 1
  56. end
  57. else increment = 1
  58.  
  59. do page = startpage to endpage by increment
  60.  
  61.     call ppm_ShowStatus("Working on page "page)
  62.     newbox  = ppm_CloneBox(box, 0, 0)
  63.     call ppm_BoxChangePage(newbox, page)
  64.  
  65.     if text ~= '' then
  66.     do
  67.         call ppm_DeleteContents(newbox)
  68.         call ppm_TextIntoBox(newbox, text)
  69.     end
  70.  
  71. end
  72.  
  73. exit_msg()
  74.  
  75. exit_msg: procedure
  76. do
  77.     parse arg message
  78.  
  79.     if message ~= '' then
  80.         call ppm_Inform(1,message,)
  81.  
  82.     call ppm_ClearStatus()
  83.     call ppm_AutoUpdate(1)
  84.     exit
  85. end
  86.  
  87.